/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * AnimalEditor.java
 *
 * Created on Apr 9, 2009, 12:11:52 PM
 */

package doghost.editors;

import doghost.DoghostApp;
import doghost.entities.Animal;
import doghost.entities.Cliente;
import doghost.entities.Raca;
import doghost.entities.Racao;
import doghost.entities.Veterinario;
import doghost.selectors.ClienteSelector;
import doghost.selectors.RacaSelector;
import doghost.selectors.RacaoSelector;
import doghost.selectors.VeterinarioSelector;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import org.jdesktop.application.Action;

/**
 *
 * @author duo
 */
public class AnimalEditor extends javax.swing.JDialog {

    protected Animal currentRecord;
    protected boolean saveFired;
    private PropertyChangeSupport propertyChangeSupport =
        new PropertyChangeSupport(this);

    /** Creates new form AnimalEditor */
    public AnimalEditor(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
    }

    /**
    * Get the value of currentRecord
    *
    * @return the value of currentRecord
    */
    public Animal getCurrentRecord() {
        return currentRecord;
    }

    /**
    * Set the value of currentRecord
    *
    * @param currentRecord new value of currentRecord
    */
    public void setCurrentRecord(Animal currentRecord) {
        Animal oldRecord = this.currentRecord;
        this.currentRecord = currentRecord;
        propertyChangeSupport.firePropertyChange("currentRecord",
        oldRecord, currentRecord);
    }

    /**
    * Get the value of saveFired
    *
    * @return the value of saveFired
    */
    public boolean isSaveFired() {
        return saveFired;
    }

    /**
    * Set the value of saveFired
    *
    * @param saveFired new value of saveFired
    */
    public void setSaveFired(boolean saveFired) {
        this.saveFired = saveFired;
    }

    @Override
    public void addPropertyChangeListener(PropertyChangeListener listener) {
        propertyChangeSupport.addPropertyChangeListener(listener);
    }

    @Override
    public synchronized void removePropertyChangeListener(PropertyChangeListener listener) {
        propertyChangeSupport.removePropertyChangeListener(listener);
    }

    @Action
    public void saveAnimal() {
        setSaveFired(true);
        setVisible(false);
    }

    @Action
    public void cancelAnimal() {
        setSaveFired(false);
        setVisible(false);
    }

    @Action
    public void selectCliente() {
        ClienteSelector clienteSelector = new ClienteSelector(DoghostApp.getApplication().getMainFrame(), true);
        clienteSelector.setLocationRelativeTo(DoghostApp.getApplication().getMainFrame());
        clienteSelector.setVisible(true);
        Cliente selectedCliente = clienteSelector.getSelectedCliente();
        if(selectedCliente != null) {
            this.getCurrentRecord().setCliente(selectedCliente);
            if(!this.clienteList.contains(selectedCliente)) {
                this.clienteList.add(selectedCliente);
                this.clienteComboBox.setSelectedItem(selectedCliente);
            }
        }
    }

    @Action
    public void selectRaca() {
        RacaSelector racaSelector = new RacaSelector(DoghostApp.getApplication().getMainFrame(), true);
        racaSelector.setLocationRelativeTo(DoghostApp.getApplication().getMainFrame());
        racaSelector.setVisible(true);
        Raca selectedRaca = racaSelector.getSelectedRaca();
        if(selectedRaca != null) {
            this.getCurrentRecord().setRaca(selectedRaca);
            if(!this.racaList.contains(selectedRaca)) {
                this.racaList.add(selectedRaca);
                this.racaComboBox.setSelectedItem(selectedRaca);
            }
        }
    }

    @Action
    public void selectVeterinario() {
        VeterinarioSelector veterinarioSelector = new VeterinarioSelector(DoghostApp.getApplication().getMainFrame(), true);
        veterinarioSelector.setLocationRelativeTo(DoghostApp.getApplication().getMainFrame());
        veterinarioSelector.setVisible(true);
        Veterinario selectedVeterinario = veterinarioSelector.getSelectedVeterinario();
        if(selectedVeterinario != null) {
            this.getCurrentRecord().setVeterinario(selectedVeterinario);
            if(!this.veterinarioList.contains(selectedVeterinario)) {
                this.veterinarioList.add(selectedVeterinario);
                this.veterinarioComboBox.setSelectedItem(selectedVeterinario);
            }
        }
    }

    @Action
    public void selectRacao() {
        RacaoSelector racaoSelector = new RacaoSelector(DoghostApp.getApplication().getMainFrame(), true);
        racaoSelector.setLocationRelativeTo(DoghostApp.getApplication().getMainFrame());
        racaoSelector.setVisible(true);
        Racao selectedRacao = racaoSelector.getSelectedRacao();
        if(selectedRacao != null) {
            this.getCurrentRecord().setRacao(selectedRacao);
            if(!this.racaoList.contains(selectedRacao)) {
                this.racaoList.add(selectedRacao);
                this.racaoComboBox.setSelectedItem(selectedRacao);
            }
        }
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        bindingGroup = new org.jdesktop.beansbinding.BindingGroup();

        doghostPUEntityManager = java.beans.Beans.isDesignTime() ? null : javax.persistence.Persistence.createEntityManagerFactory("doghostPU").createEntityManager();
        clienteQuery = java.beans.Beans.isDesignTime() ? null : doghostPUEntityManager.createQuery("SELECT c FROM Cliente c");
        clienteList = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : org.jdesktop.observablecollections.ObservableCollections.observableList(clienteQuery.getResultList());
        veterinarioQuery = java.beans.Beans.isDesignTime() ? null : doghostPUEntityManager.createQuery("SELECT v FROM Veterinario v");
        veterinarioList = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : veterinarioQuery.getResultList();
        racaQuery = java.beans.Beans.isDesignTime() ? null : doghostPUEntityManager.createQuery("SELECT r FROM Raca r");
        racaList = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : racaQuery.getResultList();
        racaoQuery = java.beans.Beans.isDesignTime() ? null : doghostPUEntityManager.createQuery("SELECT r FROM Racao r");
        racaoList = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : racaoQuery.getResultList();
        customFormattedDateConverter1 = new doghost.utils.CustomFormattedDateConverter();
        jLabel1 = new javax.swing.JLabel();
        nomeTextField = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        clienteComboBox = new javax.swing.JComboBox();
        jLabel3 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        caracteristicasTextArea = new javax.swing.JTextArea();
        saveButton = new javax.swing.JButton();
        cancelButton = new javax.swing.JButton();
        jLabel4 = new javax.swing.JLabel();
        nacimentoFormattedTextField = new javax.swing.JFormattedTextField();
        jLabel5 = new javax.swing.JLabel();
        veterinarioComboBox = new javax.swing.JComboBox();
        alternaVeterinarioCheckBox = new javax.swing.JCheckBox();
        jLabel6 = new javax.swing.JLabel();
        racaComboBox = new javax.swing.JComboBox();
        jLabel7 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        obsSaudeTextArea = new javax.swing.JTextArea();
        jLabel8 = new javax.swing.JLabel();
        racaoComboBox = new javax.swing.JComboBox();
        jLabel9 = new javax.swing.JLabel();
        jScrollPane3 = new javax.swing.JScrollPane();
        obsRacaoTextArea = new javax.swing.JTextArea();
        clienteSelectorButton = new javax.swing.JButton();
        racaSelectorButton = new javax.swing.JButton();
        racaSelectorButton1 = new javax.swing.JButton();
        racaSelectorButton2 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(doghost.DoghostApp.class).getContext().getResourceMap(AnimalEditor.class);
        setTitle(resourceMap.getString("Form.title")); // NOI18N
        setName("Form"); // NOI18N

        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        nomeTextField.setName("nomeTextField"); // NOI18N

        org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${currentRecord.nome}"), nomeTextField, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        clienteComboBox.setName("clienteComboBox"); // NOI18N

        org.jdesktop.swingbinding.JComboBoxBinding jComboBoxBinding = org.jdesktop.swingbinding.SwingBindings.createJComboBoxBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, clienteList, clienteComboBox);
        bindingGroup.addBinding(jComboBoxBinding);
        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${currentRecord.cliente}"), clienteComboBox, org.jdesktop.beansbinding.BeanProperty.create("selectedItem"));
        bindingGroup.addBinding(binding);

        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setName("jLabel3"); // NOI18N

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        caracteristicasTextArea.setColumns(20);
        caracteristicasTextArea.setLineWrap(true);
        caracteristicasTextArea.setRows(5);
        caracteristicasTextArea.setWrapStyleWord(true);
        caracteristicasTextArea.setName("caracteristicasTextArea"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${currentRecord.caracteristicas}"), caracteristicasTextArea, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        jScrollPane1.setViewportView(caracteristicasTextArea);

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(doghost.DoghostApp.class).getContext().getActionMap(AnimalEditor.class, this);
        saveButton.setAction(actionMap.get("saveAnimal")); // NOI18N
        saveButton.setText(resourceMap.getString("saveButton.text")); // NOI18N
        saveButton.setName("saveButton"); // NOI18N

        cancelButton.setAction(actionMap.get("cancelAnimal")); // NOI18N
        cancelButton.setText(resourceMap.getString("cancelButton.text")); // NOI18N
        cancelButton.setName("cancelButton"); // NOI18N

        jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
        jLabel4.setName("jLabel4"); // NOI18N

        try {
            nacimentoFormattedTextField.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("##/##/####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        nacimentoFormattedTextField.setName("nacimentoFormattedTextField"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${currentRecord.nacimento}"), nacimentoFormattedTextField, org.jdesktop.beansbinding.BeanProperty.create("value"));
        binding.setConverter(customFormattedDateConverter1);
        bindingGroup.addBinding(binding);

        jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
        jLabel5.setName("jLabel5"); // NOI18N

        veterinarioComboBox.setName("veterinarioComboBox"); // NOI18N

        jComboBoxBinding = org.jdesktop.swingbinding.SwingBindings.createJComboBoxBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, veterinarioList, veterinarioComboBox);
        bindingGroup.addBinding(jComboBoxBinding);
        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${currentRecord.veterinario}"), veterinarioComboBox, org.jdesktop.beansbinding.BeanProperty.create("selectedItem"));
        bindingGroup.addBinding(binding);

        alternaVeterinarioCheckBox.setText(resourceMap.getString("alternaVeterinarioCheckBox.text")); // NOI18N
        alternaVeterinarioCheckBox.setName("alternaVeterinarioCheckBox"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${currentRecord.alternaVeterinario}"), alternaVeterinarioCheckBox, org.jdesktop.beansbinding.BeanProperty.create("selected"));
        bindingGroup.addBinding(binding);

        jLabel6.setText(resourceMap.getString("jLabel6.text")); // NOI18N
        jLabel6.setName("jLabel6"); // NOI18N

        racaComboBox.setName("racaComboBox"); // NOI18N

        jComboBoxBinding = org.jdesktop.swingbinding.SwingBindings.createJComboBoxBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, racaList, racaComboBox);
        bindingGroup.addBinding(jComboBoxBinding);
        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${currentRecord.raca}"), racaComboBox, org.jdesktop.beansbinding.BeanProperty.create("selectedItem"));
        bindingGroup.addBinding(binding);

        jLabel7.setText(resourceMap.getString("jLabel7.text")); // NOI18N
        jLabel7.setName("jLabel7"); // NOI18N

        jScrollPane2.setName("jScrollPane2"); // NOI18N

        obsSaudeTextArea.setColumns(20);
        obsSaudeTextArea.setLineWrap(true);
        obsSaudeTextArea.setRows(5);
        obsSaudeTextArea.setWrapStyleWord(true);
        obsSaudeTextArea.setName("obsSaudeTextArea"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${currentRecord.obsSaude}"), obsSaudeTextArea, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        jScrollPane2.setViewportView(obsSaudeTextArea);

        jLabel8.setText(resourceMap.getString("jLabel8.text")); // NOI18N
        jLabel8.setName("jLabel8"); // NOI18N

        racaoComboBox.setName("racaoComboBox"); // NOI18N

        jComboBoxBinding = org.jdesktop.swingbinding.SwingBindings.createJComboBoxBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, racaoList, racaoComboBox);
        bindingGroup.addBinding(jComboBoxBinding);
        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${currentRecord.racao}"), racaoComboBox, org.jdesktop.beansbinding.BeanProperty.create("selectedItem"));
        bindingGroup.addBinding(binding);

        jLabel9.setText(resourceMap.getString("jLabel9.text")); // NOI18N
        jLabel9.setName("jLabel9"); // NOI18N

        jScrollPane3.setName("jScrollPane3"); // NOI18N

        obsRacaoTextArea.setColumns(20);
        obsRacaoTextArea.setLineWrap(true);
        obsRacaoTextArea.setRows(5);
        obsRacaoTextArea.setWrapStyleWord(true);
        obsRacaoTextArea.setName("obsRacaoTextArea"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${currentRecord.obsRacao}"), obsRacaoTextArea, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        jScrollPane3.setViewportView(obsRacaoTextArea);

        clienteSelectorButton.setAction(actionMap.get("selectCliente")); // NOI18N
        clienteSelectorButton.setText(resourceMap.getString("clienteSelectorButton.text")); // NOI18N
        clienteSelectorButton.setName("clienteSelectorButton"); // NOI18N

        racaSelectorButton.setAction(actionMap.get("selectRaca")); // NOI18N
        racaSelectorButton.setName("racaSelectorButton"); // NOI18N

        racaSelectorButton1.setAction(actionMap.get("selectVeterinario")); // NOI18N
        racaSelectorButton1.setName("racaSelectorButton1"); // NOI18N

        racaSelectorButton2.setAction(actionMap.get("selectRacao")); // NOI18N
        racaSelectorButton2.setName("racaSelectorButton2"); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(saveButton)
                        .addGap(18, 18, 18)
                        .addComponent(cancelButton)
                        .addGap(370, 370, 370))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGap(19, 19, 19)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel1)
                            .addComponent(jLabel2)
                            .addComponent(jLabel6)
                            .addComponent(jLabel4)
                            .addComponent(jLabel5)
                            .addComponent(jLabel8))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(alternaVeterinarioCheckBox, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 336, Short.MAX_VALUE)
                            .addComponent(racaoComboBox, javax.swing.GroupLayout.Alignment.LEADING, 0, 336, Short.MAX_VALUE)
                            .addComponent(veterinarioComboBox, javax.swing.GroupLayout.Alignment.LEADING, 0, 336, Short.MAX_VALUE)
                            .addComponent(nomeTextField, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 260, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(clienteComboBox, javax.swing.GroupLayout.Alignment.LEADING, 0, 336, Short.MAX_VALUE)
                            .addComponent(nacimentoFormattedTextField, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(racaComboBox, javax.swing.GroupLayout.Alignment.LEADING, 0, 336, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(clienteSelectorButton)
                            .addComponent(racaSelectorButton)
                            .addComponent(racaSelectorButton1)
                            .addComponent(racaSelectorButton2))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel9)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.LEADING))
                    .addComponent(jLabel7)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addContainerGap()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel2)
                                    .addComponent(clienteComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(18, 18, 18)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel1)
                                    .addComponent(nomeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(18, 18, 18)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel6)
                                    .addComponent(racaComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(layout.createSequentialGroup()
                                .addGap(133, 133, 133)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel4)
                                    .addComponent(nacimentoFormattedTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel5)
                            .addComponent(veterinarioComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addComponent(alternaVeterinarioCheckBox)
                        .addGap(42, 42, 42)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(racaoComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel8))
                        .addGap(64, 64, 64)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(saveButton)
                            .addComponent(cancelButton)))
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel3)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(jLabel7)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(clienteSelectorButton)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 81, Short.MAX_VALUE)
                                .addComponent(racaSelectorButton)
                                .addGap(50, 50, 50)
                                .addComponent(racaSelectorButton1)
                                .addGap(85, 85, 85)))
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel9)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(racaSelectorButton2))))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        bindingGroup.bind();

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                AnimalEditor dialog = new AnimalEditor(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JCheckBox alternaVeterinarioCheckBox;
    private javax.swing.JButton cancelButton;
    private javax.swing.JTextArea caracteristicasTextArea;
    private javax.swing.JComboBox clienteComboBox;
    private java.util.List<doghost.entities.Cliente> clienteList;
    private javax.persistence.Query clienteQuery;
    private javax.swing.JButton clienteSelectorButton;
    private doghost.utils.CustomFormattedDateConverter customFormattedDateConverter1;
    private javax.persistence.EntityManager doghostPUEntityManager;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JFormattedTextField nacimentoFormattedTextField;
    private javax.swing.JTextField nomeTextField;
    private javax.swing.JTextArea obsRacaoTextArea;
    private javax.swing.JTextArea obsSaudeTextArea;
    private javax.swing.JComboBox racaComboBox;
    private java.util.List<doghost.entities.Raca> racaList;
    private javax.persistence.Query racaQuery;
    private javax.swing.JButton racaSelectorButton;
    private javax.swing.JButton racaSelectorButton1;
    private javax.swing.JButton racaSelectorButton2;
    private javax.swing.JComboBox racaoComboBox;
    private java.util.List<doghost.entities.Racao> racaoList;
    private javax.persistence.Query racaoQuery;
    private javax.swing.JButton saveButton;
    private javax.swing.JComboBox veterinarioComboBox;
    private java.util.List<doghost.entities.Veterinario> veterinarioList;
    private javax.persistence.Query veterinarioQuery;
    private org.jdesktop.beansbinding.BindingGroup bindingGroup;
    // End of variables declaration//GEN-END:variables

}
